class DefinicionUtils {

    static buildHeaderShow(String title,String ctrl){
        String html='<div class="menu">'+
          '<table width="100%" cellpadding="0" cellspacing="0">'+
            '<tr><td class="t"     width="70%"><b><span>'+title+'</span></b></td>'+
                '<td class="icons" width="30%">'+
                    buildLink(ctrl,'create')+
                    buildLink(ctrl,'save')+
                    buildLink(ctrl,'delete')+
              '</td></tr></table></div>'

        return html

    }
    static buildHeaderShow_N_G(String title,String ctrl){
        String html='<div class="menu">'+
          '<table width="100%" cellpadding="0" cellspacing="0">'+
            '<tr><td class="t"     width="70%"><b><span>'+title+'</span></b></td>'+
                '<td class="icons" width="30%">'+
                    buildLink(ctrl,'create')+
                    buildLink(ctrl,'save')+
              '</td></tr></table></div>'

        return html

    }
    
    static buildHeaderList(String ctrl, String action){
        String html='<div class="menu">'+
          '<table width="100%" cellpadding="0" cellspacing="0">'+
            '<tr><td width="20%" >&nbsp;</td>'+
                 '<td class="icons" width="80%"><input type="text" name="" onKeyPress="if(onEnter(event)){goToShow(\''+ctrl+'\',\''+action+'\')}" id="searchField"/>&nbsp;'+
                    buildLink(ctrl, action)+
              '</td></tr></table></div>'
        return html
    }
    static buildLink(String ctrl,String action,String icon){                
        def titulo = ""
        if (icon.equals("save")){
            titulo = "Guardar"
        } else if (icon.equals("delete")) {
            titulo = "Eliminar"
        }  else if (icon.equals("create")){
            titulo = "Nuevo"
        }
        return '<a href="javascript:" onclick="return goToShow(\''+ctrl+'\',\''+action+'\')"><span title="'+titulo+'" class="icon '+icon+'">&nbsp;</span></a>'
    }
    static buildLink(String ctrl,String action){
        return buildLink(ctrl,action,action)
    }
    
    static buildSimpleHeaderShow(String title,String ctrl){
        String html='<div class="menu">'+
          '<table width="100%" cellpadding="0" cellspacing="0">'+
            '<tr><td class="t"     width="70%"><b><span>'+title+'</span></b></td>'+
                '<td class="icons" width="30%">'+
                    buildLink(ctrl,'save')+
              '</td></tr></table></div>'
        return html
    }
	
}

